*******************************************	   
************* ///TABLE A.5. - DIFFERENT LEVELS OF GOLD PRODUCTION
*******************************************	   

clear all
clear matrix
set more off

* Data for analysis:

use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/panel_excombatientes.dta", clear 

eststo clear
set more off

sum mean_gold_production, detail
gen production_mean = r(mean)
gen belowmean=.
replace belowmean= 1 if oro_sin_titulo<=production_mean

sum mean_gold_production, detail
gen percentile25 = r(p25)
gen per25=.
replace per25= 1 if oro_sin_titulo<=percentile25

eststo clear
set more off

*below the mean
reghdfe diffcaptures_f mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if belowmean==1, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
estadd local BC = "$\checkmark$"
estadd local CO = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

*below 25 percentil
reghdfe diffcaptures_f mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if per25==1, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
estadd local BC = "$\checkmark$"
estadd local CO = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

*Non-gold municipalities
reghdfe diffcaptures_f mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if oro_sin_titulo==0, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
estadd local BC = "$\checkmark$"
estadd local CO = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo	   

 
///  For table A5 
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA5.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep SDDep N ALLFE TT MT BC CO, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc %12.0fc  %12.0fc ) ///
	   label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality, Year, and Group FE" "\small Time Trends" "\small Region $\times$ Year"  ///
		"\small Municipality Characteristics TT" "\small Individual Covariates" )) ///
	   keep(mean_gold_shock_r ) ///
	   varlabels(mean_gold_shock_r "Average Shock" ) ///
	   ti("The effect of the economic shock for different levels of gold production") ///	  
	   replace  

///  For table A27 
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA27.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep SDDep N ALLFE TT MT BC CO, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc %12.0fc  %12.0fc ) ///
	   label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality, Year, and Group FE" "\small Time Trends" "\small Region $\times$ Year"  ///
		"\small Municipality Characteristics TT" "\small Individual Covariates" )) ///
	   varlabels(mean_gold_shock_r "Average Shock" ) ///
	   ti("The effect of the economic shock for different levels of gold production") ///	  
	   replace  	   
